<?php

class GroupsController extends FormController
{

  protected $table = 'acl_groups';

  protected $pk = 'group_id';

  protected function initialize()
  {
    parent::initialize();

    $permissions = new FormElement_AjaxCheckboxes('group_id', 'Permissions');
    $permissions->table = 'acl_permissions';
    $permissions->keyField = 'permission_id';
    $permissions->labelField = 'permission_name';
    $permissions->assocTable = 'acl_groups_permissions';

    $this->Form->addElement(new FormElement_Text('group_name', 'Name'));
    $this->Form->addElement($permissions, Form::ACTION_INDEX | Form::ACTION_EDIT);
  }

}
